<template>
    <div>
       <div class="mycharts" ref="charts"></div> 
    </div>
</template>

<script>
//导入echarts库
import * as echarts from 'echarts'
export default {
    mounted(){
        //定义一个echarts配置选项对象
        let options={
           //xAxis:x轴的设置
           xAxis:{
             data:['初中','高中','大专','硕士','博士']
           },
           //yAxis:y周的设置
           yAxis:{},
           //数据的设置
           series:[
             {
                type:'bar',//设置为柱状图
                name:'人数',
                data:[15,20,50,20,10]
             }
           ]
        }
        //echarts初始化
        let mychart=echarts.init(this.$refs.charts)
        //设置
        mychart.setOption(options)
    }
}
</script>

<style>
    .mycharts{
        width: 800px;
        height: 400px;
    }
</style>